<?php
session_start();

$currentUser = isset($_SESSION["user"])?$_SESSION["user"]:null;
if ($currentUser) echo "welcome!";

//怎么判定访问该网站的人登陆过了
//$myid = isset($_COOKIE["myId"])?$_COOKIE["myId"]:null;
//if ($myid) echo "welcome!";

else echo "access denied!";
?>